package com.boge.modules.ssgf.service.impl;

import com.boge.modules.sys.controller.WebController;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.boge.common.utils.PageUtils;
import com.boge.common.utils.Query;

import com.boge.modules.ssgf.dao.MaintenanceDao;
import com.boge.modules.ssgf.entity.MaintenanceEntity;
import com.boge.modules.ssgf.service.MaintenanceService;


@Service("maintenanceService")
public class MaintenanceServiceImpl extends ServiceImpl<MaintenanceDao, MaintenanceEntity> implements MaintenanceService {

    @Override
    public PageUtils queryPage(Map<String, Object> params) {
        IPage<MaintenanceEntity> page = this.page(
                new Query<MaintenanceEntity>().getPage(params),
                new QueryWrapper<MaintenanceEntity>()
        );

        List<MaintenanceEntity> records = page.getRecords();
        if(records != null && records.size() > 0){
            for (MaintenanceEntity record : records) {
                record.setImgUrl(record.getImg());
                record.setImg(WebController.BASE_URL+record.getImg());
            }
        }

        return new PageUtils(page);
    }

}